package com.baizhi.contorller;

import com.baizhi.eneity.Student;
import com.baizhi.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@RestController
@CrossOrigin
public class StudentContorller {
    @Autowired
    private StudentService studentService;

    @GetMapping("queryStudent")
    public List<Student> query(){
            return studentService.query();
        }

     @DeleteMapping("delete/{id}")
    public void delete(@PathVariable("id") Integer id){
        studentService.delete(id);
     }

     @PutMapping("update")
      public void update(@RequestBody Student student){
         System.out.println(student);
        studentService.update(student);
     }
     @PostMapping("add")
      public void save(@RequestBody Student student){
        studentService.save(student);
     }

     }


